<?php




/**
* Lists entities in categories
*/

# When a user will cancel add/edit forms, we will try to come back here
url::remember();

# Begin the paginator along with: categories
# Parameter: GET[], and per page
$pagination = new pagination('pg', __PER_PAGE__);

$categories = new categories();

$search = $variable->post('search-query', 'string', '');
$search_query = $variable->remember_string('search-query');
$smarty->assign('search_query', $search_query);

$condition = new condition();

$condition->add('FULL', array(
	"e.subdomain_id={$subdomain_id}", # Bind the records
	"e.is_active='Y'", # Do not remove this
	"e.is_approved='Y'", # Optionally use this flag
));

# Compulsory conditions
$condition->add('AND', array(
	#'e.search_field' => 'Y', # Partial %contents%
));

# List out the entries
$entries = $categories->list_entries(
	$condition,
	$from_index=$pagination->begining_entry(),
	$pagination->per_page()
);

# Pagination helper
$pagination->set_total($categories->total_entries());
$smarty->assignByRef('pagination', $pagination);

# Assign to Smarty: Lists
$smarty->assignByRef('categoriess', $entries);
?>